home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19990422-19990725 / 000154_news@watsun.cc.columbia.edu _Mon Jun 14 12:52:52 1999.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Return-Path: <news@watsun.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id MAA27935
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Mon, 14 Jun 1999 12:52:52 -0400 (EDT)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id JAA27457
  7.     for kermit.misc@watsun.cc.columbia.edu; Mon, 14 Jun 1999 09:56:00 -0400 (EDT)
  8. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Subject: Re: c-kermit output to stderr on linux
  11. Date: 14 Jun 1999 13:55:59 GMT
  12. Organization: Columbia University
  13. Message-ID: <7k31lf$qpv$1@newsmaster.cc.columbia.edu>
  14. To: kermit.misc@watsun.cc.columbia.edu
  15.  
  16. In article <3765058E.C11E22C6@asares.com>,
  17. Brian J. Corcoran <corcoran@asares.com> wrote:
  18. : Frank da Cruz wrote:
  19. : > In article <3762DA05.B12F366E@asares.com>,
  20. : > Brian J. Corcoran <corcoran@asares.com> wrote:
  21. : > : I'm trying to get a kermit script to output info to stderr with the
  22. : > : following command:
  23. : > :
  24. : > : writeln error {text line}
  25. : > :
  26. : > : ...but it's still outputing to stdout. Can anybody help with this?
  27. : > :
  28. : > You're right, it seems to be doing that.  Yet the code is using
  29. : > "fprintf(stderr,...)" in this case.  The reason that the text is not
  30. : > actually going to stderr is not obvious.
  31. : >
  32. : > : If I can't get around the problem this way, is there an easy way to
  33. : > : suppress all output from a script, except for certain text?
  34. : > :
  35. : > WRITE[LN] ERROR should be the way to do it.  However, a workaround (for
  36. : > UNIX) would be:
  37. : >
  38. : >   open write /dev/tty
  39. : >
  40. : > and then use WRITE (or WRITELN) FILE.
  41. : ah, but that still sends to stdout, rather than stderr, no? I think I've
  42. : found a work-around by using a similar concept, using a dedicated named
  43. : pipe.
  44. If I make a script file, x, containing:
  45.  
  46.   #!./wermit
  47.   open write /dev/tty
  48.   if fail exit
  49.   writeln screen (1) This is written to stdout.
  50.   writeln error (2) This is written to stderr.
  51.   writeln file (3) This is written to /dev/tty.
  52.  
  53. And then in Bash:
  54.  
  55.   $ chmod +x ./x
  56.   $ ./x > foo
  57.  
  58. I get:
  59.  
  60.   (3) This is written to /dev/tty.
  61.  
  62. on the screen and:
  63.  
  64.   (1) This is written to stdout.
  65.   (2) This is written to stderr..
  66.  
  67. written to foo.
  68.  
  69. : > : Finally, I've noticed writeln/write-line behaves as write when
  70. : > : outputting to stdout (it doesn't include the new-line character). Is
  71. : > : this correct behavior?
  72. : > :
  73. : > No, it's a bug.  This will be corrected in the next Beta edit.  Hopefully
  74. : > by then I will also have figured out why writes to sdterr are not going
  75. : > to stderr.
  76. : >
  77. : > I suspect there must be code somewhere that sends stderr to stdout so
  78. : > error messages will come out in sequence with other text, rather than
  79. : > butting ahead, but the spot is not obvious.  Anyway, if this was done,
  80. : > it was probably done for a reason and so fixing it will no doubt break
  81. : > something else.  I'll try to sort this out in the next Beta.
  82. :
  83. This was identified and fixed yesterday; the fix will be in Beta.08.
  84. So now:
  85.  
  86.   $ ./x > y
  87.   (2) This is written to stderr.
  88.   (3) This is written to /dev/tty.
  89.   $ ./x 2> y
  90.   (1) This is written to stdout.
  91.   (3) This is written to /dev/tty.
  92.   $
  93.  
  94. - Frank